/** @file               sw_timer.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_TIMER_H__
#define __SW_TIMER_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID *SW_TIMER;
#define SW_INVALID_TIMER NULL

typedef SW_RET (*SW_TIMER_PROC)(SW_VOID *pArg, SW_TIMER timer);

SW_API SW_RET SW_InitTimerAPI(SW_VOID);
SW_API SW_RET SW_RunTimerAPI(SW_VOID);
SW_API SW_RET SW_StopTimerAPI(SW_VOID);
SW_API SW_RET SW_ExitTimerAPI(SW_VOID);
SW_API SW_TIMER SW_CreateTimer(const SW_CHAR *pName, SW_UINT32 interval, SW_UINT32 count, SW_TIMER_PROC proc, SW_VOID *pArg);
SW_API SW_RET SW_DeleteTimer(SW_TIMER timer);
SW_API SW_BOOL SW_IsTimerAlive(SW_TIMER timer);
SW_API const SW_CHAR *SW_GetTimerName(SW_TIMER timer);
SW_API SW_RET SW_SetTimerInterval(SW_TIMER timer, SW_UINT32 interval);
SW_API SW_UINT32 SW_GetTimerInterval(SW_TIMER timer);
SW_API SW_RET SW_SetTimerCount(SW_TIMER timer, SW_UINT32 count);
SW_API SW_UINT32 SW_GetTimerCount(SW_TIMER timer);
SW_API SW_RET SW_SetTimerProc(SW_TIMER timer, SW_TIMER_PROC proc);
SW_API SW_TIMER_PROC SW_GetTimerProc(SW_TIMER timer);
SW_API SW_RET SW_SetTimerArg(SW_TIMER timer, SW_VOID *pArg);
SW_API SW_VOID *SW_GetTimerArg(SW_TIMER timer);
SW_API SW_RET SW_StartTimer(SW_TIMER timer);
SW_API SW_RET SW_StopTimer(SW_TIMER timer);
SW_API SW_TIMER SW_StartInterval(const SW_CHAR *pName, SW_UINT32 interval, SW_TIMER_PROC proc, SW_VOID *pArg);
SW_API SW_RET SW_StartTimeout(const SW_CHAR *pName, SW_UINT32 timeout, SW_TIMER_PROC proc, SW_VOID *pArg);

#ifdef __cplusplus
}
#endif

#endif

